#include <iostream>
using namespace std;

void reverse(int i,int j,char arr[])
{
	while(i<j)
	{
		char temp = arr[i];
		arr[i] = arr[j];
		arr[j] = temp;
		++i;
		--j;
	}
}

void leftRotateString(char arr[], int length ,int x)
{
	if(arr == nullptr || length < x || x < 0)
		return ;
	reverse(0,x-1,arr);
	reverse(x,length-1,arr);
	reverse(0,length-1,arr);
	cout<<arr<<endl;
}

int main()
{
	char arr[] = "abcdeft";
	leftRotateString(arr,7,2);
	leftRotateString(arr,7,0);
	leftRotateString(arr,7,6);
	leftRotateString(arr,7,7);
	leftRotateString(arr,7,8);

	return 0;
}
